package br.com.center.loja.mb;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.model.SelectItem;

import br.com.center.loja.mb.utils.BrazilState;
import br.com.center.loja.model.Neighborhood;

@ManagedBean(name="neighborhood")
@ViewScoped
public class NeighborhoodMB extends AbstractMB<Neighborhood> 
{
	private static final long serialVersionUID = 1L;
	
	public NeighborhoodMB() 
	{
		super(Neighborhood.class);
	}
	
	public SelectItem[] getStateItems(){
		BrazilState[] states = BrazilState.values();
		SelectItem[] items = new SelectItem[states.length];
		int position = 0;
		
		for (BrazilState state : states) {
			items[position++] = new SelectItem(state.name(), state.getName());
		}
		
		return items;
	}	
}
